<?php
Class UserContact{
	
	private $id;
	private $user ;
	private $contact ;
	private $valeur;
	
	public function UserContact(){
		$this->id;
		$this->user;
		$this->contact;
		$this->valeur;
	}
	
	public function getId(){
		return $this->id;
	}
	
	public function getUser() {
		return $this->user;
	}

	public function getContact() {
		return $this->contact;
	}

	public function getValeur() {
		return $this->valeur;
	}
	
	public function setId($id){
		$this->id = $id;
	}

	public function setUser($user) {
		$this->user = $user;
	}

	public function setContact($contact) {
		$this->contact = $contact;
	}

	public function setValeur($valeur) {
		$this->valeur = $valeur;
	}

	public function getAll(){
		$connect = new Connect();
		$connect = $connect->findAll('users_contacts');
		return $connect;
	}
	
	public function getOne($id){
		$connect = new Connect();
		$connect = $connect->findById('users_contacts',$id);
		return $connect;
	}
	
	public function save(UserContact $userc){
		$connect = new Connect();
		$connect = $connect->insert('users_contacts',array('utilisateur_id' => $userc->getUser(),'contact_id' => $userc->getContact(),'valeur' => $userc->getValeur()));
		return $connect;
	}
	
	public function update($id,$userc){
		$connect = new Connect();
		$connect = $connect->update('users_contacts',$id,array('utilisateur_id' => $userc->getUser(),'contact_id' => $userc->getContact(),'valeur' => $userc->getValeur()));
		return $connect;
	}
	
	public function delete($id){
		$connect = new Connect();
		$connect = $connect->delete('users_contacts',$id);
		return $connect;
	}
	
}